<?php

namespace app\admin\controller;

use think\facade\View;

class Common extends Controller
{
    public function get_upload_token()
    {
        $params = input();
        $upload_type = config('upload.platform');
        $class = '\\bxkj_common\\' . ucfirst($upload_type);
        if (!class_exists($class)) $this->error(lang('UPLOAD_METHOD_NOT_EXIST'));
        $uploadCommon = new $class();
        $res = call_user_func_array([$uploadCommon, 'upload'], [$params]);
        if ($res['code'] != 200) return $this->error($res['msg']);
        $this->success(lang('SUCCESS'), $res['result']);
    }

    public function test()
    {
        return View::fetch();
    }
}